

###APPENDIX TABLES###

##Table A1##
essdata<-read.dta("ESS_9waves.dta")

essdata$contact<-NA
essdata$contact[essdata$contplt==1]<-1
essdata$contact[essdata$contplt==2]<-0

essdata$GB<-NA
essdata$GB[essdata$cntry=="GB"]<-1

GBdata<-subset(essdata, !is.na(GB))

tab1<-crosstab(GBdata$year, GBdata$contact, weight = GBdata$dweight, total.r=FALSE, total.c=FALSE, prop.r = TRUE, )

xtable(tab1)


##Table A3##
modelX<- lm(treatdum ~ is_donor + is_volunteer, data=data2)
msummary(modelX, star=TRUE, robust=TRUE, output='latex')


##Table A6##
WTTmodels <- list()
WTTmodels [['Model 1']] <- lm(outcome_1week ~ treatvar, data=data1)
WTTmodels [['Model 2']] <- lm(outcome_WTT1 ~ treatvar, data=data1)
WTTmodels [['Model 3']] <-  lm(outcome_WTT2 ~ treatvar, data=data1)

msummary(WTTmodels, star=TRUE, robust=TRUE, output='latex')

###APPENDIX FIGURES###

##Figure A1##

data <- read_csv("BESmerged.csv")

model0<- lm (MPdontknow ~ euRefDoOver, data=data, weight=wt)
summ(model0)
model1<- lm (votecorrect ~ euRefDoOver, data=data, weight=wt)
summ(model1)


plota<- effect_plot(model = model0, pred = euRefDoOver, robust=TRUE,
                  cat.geom="bar", cat.interval.geom="linerange",
                  colors="Greens", plot.points = TRUE, jitter = 0.15,
                  point.alpha=0.3, point.size=0.5,
                  point.color = "green4")+
  labs(title = "Self-reported claims 'Don't know' \nMP Brexit position",
       subtitle = "37,825 BES respondents",
       caption = "Data: British Election Study Wave 18 (2019)")+
  ylab("Pr(Self-reported 'don't know')")+
  xlab("Support for Second Referendum")+
  scale_x_discrete(labels=c("2" = "No position on \nPeople's Vote", "No" = "Opposses a \nPeople\'s Vote",
                            "Yes" = "Supports a \nPeople's Vote"))


plotb<- effect_plot(model = model1, pred = euRefDoOver, robust=TRUE,
                  cat.geom="bar", cat.interval.geom="linerange",
                  colors="Blues", plot.points = TRUE, jitter = 0.15,
                  point.alpha=0.3, point.size=0.5,
                  point.color = "blue4")+
  labs(title = "Mean level of correct identification of \nMP Brexit position",
       subtitle = "10,194 BES respondents reporting to know their MP position",
       caption = "Data: British Election Study Wave 18 (2019)")+
  ylab("Pr(Correctly identified MP Brexit position)")+
  xlab("Support for Second Referendum")+
  scale_x_discrete(labels=c("2" = "No position on \nPeople's Vote", "No" = "Opposses a \nPeople\'s Vote",
                            "Yes" = "Supports a \nPeople's Vote"))


plota+plotb

ggsave("FigureA1.png", width = 30, height = 24, units = "cm")


##Figure A8##
model1<- lm(outcome_1week ~ treatvar, data=data1)
plot_summs(model1, scale = TRUE, plot.distributions = TRUE, colors = "Rainbow", 
           inner_ci_level =.9,
           coefs = c("Position \n + \nurgency" = "treatvarEmail_position_urgency", 
                     "Position" = "treatvarEmail_position_nourgency",
                     "Urgency" = "treatvarEmail_noposition_urgency",
                     "No position\n + \nno urgency" = "treatvarEmail_noposition_nourgency")) +
  labs(title = "Intent-to-treat effect (95% CIs)")+
  theme(axis.title.x=element_blank(),
        plot.title = element_text(hjust = 0.5, face="bold"),
        legend.position = "none")
ggsave("FigureA8.png")

##Figure A9##
tab4<-NA

tab4 <- data.frame(c(rep("1. Full sample",1), rep("2. Donor",1), rep("3. No donor",1)))
tab4$donor <- NA
tab4$ITT<- NA
tab4$Cilower <- NA
tab4$Ciupper <- NA
colnames(tab4) <- c("Donor", "ITT","Ci_lower", "Ci_upper")

tab4$ITT<- c(full_coef[3], donor_coef[3], nodonor_coef[3])*100
tab4$Ci_upper<- c(full_cihigh[3], donor_cihigh[3], nodonor_cihigh[3])*100
tab4$Ci_lower<- c(full_cilow[3], donor_cilow[3], nodonor_cilow[3])*100

graphdb <- ggplot(tab4,aes(x = Donor, y = ITT,ymin = Ci_lower, ymax = Ci_upper))
graphdb + scale_colour_manual(values=c("black", "black")) + geom_point(position=position_dodge(width=0.8) ,size = 3) + 
  geom_linerange(position=position_dodge(width=0.5), size =0.5) +
  geom_hline(yintercept=0, colour="grey", linetype = "dashed", size = 1) +
  theme_bw() + ggtitle("ITT of urgency cue on writing to MP") + coord_cartesian(ylim = c(-1.5, 1.5)) +  ylab("ITT in %-points")
ggsave("FigureA9.png")


##Figure A10##
library(zaminfluence)
reg_fit  <- lm(data=data2, formula=outcome_1week ~ treatdum, x=TRUE, y=TRUE)

reg_infl <- ComputeModelInfluence(reg_fit)
grad_df <- GetTargetRegressorGrads(reg_infl, "treatdum")
influence_dfs <- SortAndAccumulate(grad_df)

target_change <- GetRegressionTargetChange(influence_dfs, "prop_removed")

if (FALSE) {
  plot1<- PlotInfluence(influence_dfs$sign, "prop_removed", 0.01, target_change)
  ggsave("FIgureA10.png")
}

##Figure A11##
library(sensemakr)

dataX<- data1 %>% 
  mutate(treatvar = as.numeric(treatvar),
         treatdum = as.numeric(treatdum),
         PastDonor=as.numeric(is_donor))

model1  <- lm(outcome_1week ~ treatdum, data=dataX)
summ(model1)
sensitivity <- sensemakr(model = model1, 
                         treatment = "treatdum",
                         benchmark_covariates = "PastDonor",
                         kd = 1:12)

summary(sensitivity)
ovb_minimal_reporting(sensitivity, format = "latex")

plot(sensitivity, type="extreme")

